package com.ler.yrmall.coupon.controller;

import com.ler.yrmall.coupon.form.SubmitSeckillForm;
import com.ler.yrmall.coupon.service.SeckillService;
import com.ler.yrmall.basic.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author Leron
 * @version 1.0
 */
@RestController
@RequestMapping("/seckill")
public class ClientSeckillController {

    @Resource
    private SeckillService seckillSessionService;

    @PostMapping("/submit")
    public Result<String> submit(@RequestBody SubmitSeckillForm submitSeckillForm) {
        String orderNo = seckillSessionService.submitSeckillSku(submitSeckillForm);
        return Result.ok(orderNo);
    }

}
